package com.study.flink.batch;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.CrossOperator;
import org.apache.flink.api.java.operators.DataSource;

import java.util.ArrayList;

/**
 * @author stephen
 * @create 2019-01-28 21:05
 * @since 1.0.0
 */
public class BatchDemoWithCross {

    public static void main(String[] args) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

        ArrayList<Integer> data1 = new ArrayList<>();
        data1.add(1);
        data1.add(2);
        data1.add(3);

        ArrayList<String> data2 = new ArrayList<>();
        data2.add("s");
        data2.add("z");
        data2.add("x");

        DataSource<Integer> source1 = env.fromCollection(data1);
        DataSource<String> source2 = env.fromCollection(data2);

        CrossOperator.DefaultCross<Integer, String> result = source1.cross(source2);

        result.print();
    }
}
